<?php


namespace Part02_StrategyMode\Code5;

class CashRebate extends CashSuper
{
    private $moneyRebate;

    /**
     * 初始化必须传入折扣率，比如八折，传入0.8
     * CashRebate constructor.
     * @param $moneyRebate
     */
    public function __construct($moneyRebate)
    {
        $this->moneyRebate = $moneyRebate;
    }

    /**
     * @param float $money
     * @return float|int
     * @date: 2021/9/10
     * @desc: 返回价格乘以打折费率
     */
    public function acceptCash($money)
    {
        return $money * $this->moneyRebate;
    }
}